﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;

namespace KduneeShaders
{
    /// <summary>
    /// Shader oświetlenia krawędziowego
    /// </summary>
    public class RimShader : GeneralShader
    {
        /// <summary>
        /// Połyskliwość - wykładnik w równaniu na specular
        /// </summary>
        public float Shininess
        {
            get { return this.Parameters["shininess"].GetValueSingle(); }
            set { this.Parameters["shininess"].SetValue(value); }
        }

        /// <summary>
        /// Jasność oświetlenia krawędziowego
        /// </summary>
        public float RimPower
        {
            get { return this.Parameters["rimPower"].GetValueSingle(); }
            set { this.Parameters["rimPower"].SetValue(value); }
        }

        /// <summary>
        /// Kolor oświetlenia krawędziowego
        /// </summary>
        public Vector4 RimColor
        {
            get { return this.Parameters["rimColor"].GetValueVector4(); }
            set { this.Parameters["rimColor"].SetValue(value); }
        }

        /// <summary>
        /// Tekstura skalująca oświetlenie
        /// </summary>
        public Texture2D Ramp
        {
            get { return this.Parameters["rampTexture"].GetValueTexture2D(); }
            set { this.Parameters["rampTexture"].SetValue(value); }
        }

        /// <summary>
        /// Konstruktor shadera
        /// </summary>
        /// <param name="content">Menadżer danych</param>
        /// <param name="diffuse">Tekstura diffuse</param>
        public RimShader(ContentManager content, Texture2D diffuse)
            : base(content.Load<Effect>(ShadersConfig.SHADERS_PATH + @"rim"))
        {
            Diffuse = diffuse;
            Ramp = content.Load<Texture2D>(ShadersConfig.SHADERS_PATH + @"textures\ramp");
            this.CurrentTechnique = this.Techniques[0];
        }
    }
}
